package exam;



import java.util.ArrayList;
import java.util.Scanner;

public class Didi {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        for (int t = 0; t < T; t++) {
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) nums[i] = in.nextInt();
            if (n == 1 || n == 0) System.out.println("Yes");
            else {

                System.out.println("No");
            }
        }
    }
}
//        abcabc
//        2
//        bca cba
//        bab aca
//        Scanner in = new Scanner(System.in);
//        String s = in.nextLine();
//        int T = in.nextInt();
//        for(int t =0;t<T;t++){
//            String t1 = in.next();
//            String t2 = in.next();
//            while(s.indexOf(t1)>=0){
//                s = s.replaceFirst(t1,t2);
//            }
//        }
//        System.out.println(s);

